<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <script type="text/javascript" src="../javascript/jquery-3.6.0.js"></script>
</head>
<body>
<form action="">
    姓名：<input type="text" id="user"><span id="uSpan"></span><br>
    密码: <input type="password" id="password"><br>
    <button type="submit">注册</button>
</form>
<script>
    $("#user").blur(function () {
        let user = $("#user").val();
        $.get(
            "../userServlet",
            "user=" + user,
            function (data) {
                $("#uSpan").html(data);
            },
            "text"
        );
    });
</script>
</body>
</html>